package org.tech4j.edi.persistence.api.query;

import org.tech4j.edi.common.enums.RetryModelEnum;

import java.util.Map;

/**
 * @program: tech4j
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/7 15:07
 **/
public class RetryConfigQuery {
    /**
     * 主键
     */
    private String id;

    /**
     * 业务类型
     */
    private String bizType;

    /**
     * 业务名称
     */
    private String bizName;

    /**
     * 0系统自动重试 1手动重试
     */
    private RetryModelEnum retryModel;

    /**
     * 是否启用
     */
    private boolean enabled;

    /**
     * 环境变量
     */
    private String env;

    /**
     * 扩展字段
     */
    private Map<String, String> extraField;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBizType() {
        return bizType;
    }

    public void setBizType(String bizType) {
        this.bizType = bizType;
    }

    public String getBizName() {
        return bizName;
    }

    public void setBizName(String bizName) {
        this.bizName = bizName;
    }

    public RetryModelEnum getRetryModel() {
        return retryModel;
    }

    public void setRetryModel(RetryModelEnum retryModel) {
        this.retryModel = retryModel;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public Map<String, String> getExtraField() {
        return extraField;
    }

    public void setExtraField(Map<String, String> extraField) {
        this.extraField = extraField;
    }


    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public static final class Builder {
        private String id;
        private String bizType;
        private String bizName;
        private RetryModelEnum retryModel;
        private boolean enabled;
        private Map<String, String> extraField;
        private String env;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder bizType(String bizType) {
            this.bizType = bizType;
            return this;
        }

        public Builder bizName(String bizName) {
            this.bizName = bizName;
            return this;
        }

        public Builder retryModel(RetryModelEnum retryModel) {
            this.retryModel = retryModel;
            return this;
        }

        public Builder enabled(boolean enabled) {
            this.enabled = enabled;
            return this;
        }

        public Builder extraField(Map<String, String> extraField) {
            this.extraField = extraField;
            return this;
        }

        public Builder env(String env) {
            this.env = env;
            return this;
        }

        public RetryConfigQuery build() {
            RetryConfigQuery retryConfigQuery = new RetryConfigQuery();
            retryConfigQuery.setId(id);
            retryConfigQuery.setBizType(bizType);
            retryConfigQuery.setBizName(bizName);
            retryConfigQuery.setRetryModel(retryModel);
            retryConfigQuery.setEnabled(enabled);
            retryConfigQuery.setExtraField(extraField);
            retryConfigQuery.setEnv(env);
            return retryConfigQuery;
        }
    }
}
